package com.design.command.remotecontrol2;

public class CommandPatternDemo {
    public static void main(String[] args) {
        RemoteControl remoteControl = new RemoteControl();

        Light livingRoomLight = new Light();
        Fan ceilingFan = new Fan();

        Command livingRoomLightOn = new LightOnCommand(livingRoomLight);
        Command livingRoomLightOff = new LightOffCommand(livingRoomLight);
        Command ceilingFanOn = new FanOnCommand(ceilingFan);
        Command ceilingFanOff = new FanOffCommand(ceilingFan);

        remoteControl.setCommand(0, livingRoomLightOn);
        remoteControl.setCommand(1, ceilingFanOn);

        remoteControl.pressButton(0); // Turn on living room light
        remoteControl.pressButton(1); // Turn on ceiling fan
        remoteControl.pressButton(0); // Turn off living room light
        remoteControl.pressButton(1); // Turn off ceiling fan
    }
}
